home *** CD-ROM | disk | FTP | other *** search
/ Champak 142 / Volume 142 Oct 17 2011 - Damaged.iso / Interface / it.dig / scripts / __Packages / mx / core / ext / UIObjectExtensions.as < prev   
Text File  |  2011-10-17  |  7KB  |  206 lines

  1. class mx.core.ext.UIObjectExtensions
  2. {
  3.    static var bExtended = false;
  4.    static var UIObjectExtended = mx.core.ext.UIObjectExtensions.Extensions();
  5.    static var UIObjectDependency = mx.core.UIObject;
  6.    static var SkinElementDependency = mx.skins.SkinElement;
  7.    static var CSSTextStylesDependency = mx.styles.CSSTextStyles;
  8.    static var UIEventDispatcherDependency = mx.events.UIEventDispatcher;
  9.    function UIObjectExtensions()
  10.    {
  11.    }
  12.    static function addGeometry(tf, ui)
  13.    {
  14.       tf.addProperty("width",ui.__get__width,null);
  15.       tf.addProperty("height",ui.__get__height,null);
  16.       tf.addProperty("left",ui.__get__left,null);
  17.       tf.addProperty("x",ui.__get__x,null);
  18.       tf.addProperty("top",ui.__get__top,null);
  19.       tf.addProperty("y",ui.__get__y,null);
  20.       tf.addProperty("right",ui.__get__right,null);
  21.       tf.addProperty("bottom",ui.__get__bottom,null);
  22.       tf.addProperty("visible",ui.__get__visible,ui.__set__visible);
  23.    }
  24.    static function Extensions()
  25.    {
  26.       if(mx.core.ext.UIObjectExtensions.bExtended == true)
  27.       {
  28.          return true;
  29.       }
  30.       mx.core.ext.UIObjectExtensions.bExtended = true;
  31.       var _loc6_ = mx.core.UIObject.prototype;
  32.       var _loc9_ = mx.skins.SkinElement.prototype;
  33.       mx.core.ext.UIObjectExtensions.addGeometry(_loc9_,_loc6_);
  34.       mx.events.UIEventDispatcher.initialize(_loc6_);
  35.       var _loc13_ = mx.skins.ColoredSkinElement;
  36.       mx.styles.CSSTextStyles.addTextStyles(_loc6_);
  37.       var _loc5_ = MovieClip.prototype;
  38.       _loc5_.getTopLevel = _loc6_.getTopLevel;
  39.       _loc5_.createLabel = _loc6_.createLabel;
  40.       _loc5_.createObject = _loc6_.createObject;
  41.       _loc5_.createClassObject = _loc6_.createClassObject;
  42.       _loc5_.createEmptyObject = _loc6_.createEmptyObject;
  43.       _loc5_.destroyObject = _loc6_.destroyObject;
  44.       _global.ASSetPropFlags(_loc5_,"getTopLevel",1);
  45.       _global.ASSetPropFlags(_loc5_,"createLabel",1);
  46.       _global.ASSetPropFlags(_loc5_,"createObject",1);
  47.       _global.ASSetPropFlags(_loc5_,"createClassObject",1);
  48.       _global.ASSetPropFlags(_loc5_,"createEmptyObject",1);
  49.       _global.ASSetPropFlags(_loc5_,"destroyObject",1);
  50.       _loc5_.__getTextFormat = _loc6_.__getTextFormat;
  51.       _loc5_._getTextFormat = _loc6_._getTextFormat;
  52.       _loc5_.getStyleName = _loc6_.getStyleName;
  53.       _loc5_.getStyle = _loc6_.getStyle;
  54.       _global.ASSetPropFlags(_loc5_,"__getTextFormat",1);
  55.       _global.ASSetPropFlags(_loc5_,"_getTextFormat",1);
  56.       _global.ASSetPropFlags(_loc5_,"getStyleName",1);
  57.       _global.ASSetPropFlags(_loc5_,"getStyle",1);
  58.       var _loc7_ = TextField.prototype;
  59.       mx.core.ext.UIObjectExtensions.addGeometry(_loc7_,_loc6_);
  60.       _loc7_.addProperty("enabled",function()
  61.       {
  62.          return this.__enabled;
  63.       }
  64.       ,function(x)
  65.       {
  66.          this.__enabled = x;
  67.          this.invalidateStyle();
  68.       }
  69.       );
  70.       _loc7_.move = _loc9_.move;
  71.       _loc7_.setSize = _loc9_.setSize;
  72.       _loc7_.invalidateStyle = function()
  73.       {
  74.          this.invalidateFlag = true;
  75.       };
  76.       _loc7_.draw = function()
  77.       {
  78.          if(this.invalidateFlag)
  79.          {
  80.             this.invalidateFlag = false;
  81.             var _loc2_ = this._getTextFormat();
  82.             this.setTextFormat(_loc2_);
  83.             this.setNewTextFormat(_loc2_);
  84.             this.embedFonts = _loc2_.embedFonts == true;
  85.             if(this.__text != undefined)
  86.             {
  87.                if(this.text == "")
  88.                {
  89.                   this.text = this.__text;
  90.                }
  91.                delete this.__text;
  92.             }
  93.             this._visible = true;
  94.          }
  95.       };
  96.       _loc7_.setColor = function(color)
  97.       {
  98.          this.textColor = color;
  99.       };
  100.       _loc7_.getStyle = _loc5_.getStyle;
  101.       _loc7_.__getTextFormat = _loc6_.__getTextFormat;
  102.       _loc7_.setValue = function(v)
  103.       {
  104.          this.text = v;
  105.       };
  106.       _loc7_.getValue = function()
  107.       {
  108.          return this.text;
  109.       };
  110.       _loc7_.addProperty("value",function()
  111.       {
  112.          return this.getValue();
  113.       }
  114.       ,function(v)
  115.       {
  116.          this.setValue(v);
  117.       }
  118.       );
  119.       _loc7_._getTextFormat = function()
  120.       {
  121.          var _loc2_ = this.stylecache.tf;
  122.          if(_loc2_ != undefined)
  123.          {
  124.             return _loc2_;
  125.          }
  126.          _loc2_ = new TextFormat();
  127.          this.__getTextFormat(_loc2_);
  128.          this.stylecache.tf = _loc2_;
  129.          if(this.__enabled == false)
  130.          {
  131.             if(this.enabledColor == undefined)
  132.             {
  133.                var _loc4_ = this.getTextFormat();
  134.                this.enabledColor = _loc4_.color;
  135.             }
  136.             var _loc3_ = this.getStyle("disabledColor");
  137.             _loc2_.color = _loc3_;
  138.          }
  139.          else if(this.enabledColor != undefined)
  140.          {
  141.             if(_loc2_.color == undefined)
  142.             {
  143.                _loc2_.color = this.enabledColor;
  144.             }
  145.          }
  146.          return _loc2_;
  147.       };
  148.       _loc7_.getPreferredWidth = function()
  149.       {
  150.          this.draw();
  151.          return this.textWidth + 4;
  152.       };
  153.       _loc7_.getPreferredHeight = function()
  154.       {
  155.          this.draw();
  156.          return this.textHeight + 4;
  157.       };
  158.       TextFormat.prototype.getTextExtent2 = function(s)
  159.       {
  160.          var _loc3_ = _root._getTextExtent;
  161.          if(_loc3_ == undefined)
  162.          {
  163.             _root.createTextField("_getTextExtent",-2,0,0,1000,100);
  164.             _loc3_ = _root._getTextExtent;
  165.             _loc3_._visible = false;
  166.          }
  167.          _root._getTextExtent.text = s;
  168.          var _loc4_ = this.align;
  169.          this.align = "left";
  170.          _root._getTextExtent.setTextFormat(this);
  171.          this.align = _loc4_;
  172.          return {width:_loc3_.textWidth,height:_loc3_.textHeight};
  173.       };
  174.       if(_global.style == undefined)
  175.       {
  176.          _global.style = new mx.styles.CSSStyleDeclaration();
  177.          _global.cascadingStyles = true;
  178.          _global.styles = new Object();
  179.          _global.skinRegistry = new Object();
  180.          if(_global._origWidth == undefined)
  181.          {
  182.             _global.origWidth = Stage.width;
  183.             _global.origHeight = Stage.height;
  184.          }
  185.       }
  186.       var _loc4_ = _root;
  187.       while(_loc4_._parent != undefined)
  188.       {
  189.          _loc4_ = _loc4_._parent;
  190.       }
  191.       _loc4_.addProperty("width",function()
  192.       {
  193.          return Stage.width;
  194.       }
  195.       ,null);
  196.       _loc4_.addProperty("height",function()
  197.       {
  198.          return Stage.height;
  199.       }
  200.       ,null);
  201.       _global.ASSetPropFlags(_loc4_,"width",1);
  202.       _global.ASSetPropFlags(_loc4_,"height",1);
  203.       return true;
  204.    }
  205. }
  206.